package com.chenhao.springcloud.chenhaodatastructureservice.sort;

import java.util.Random;

/**
 * Description:生成数组
 *
 * @author chenhao
 * @date 2020/12/4 12:01
 */
public class ArrayGenerator {

    private ArrayGenerator(){}

    public static Integer[] generateOrderedArry(int n){
        Integer [] arr = new Integer[n];
        for (int i=0;i<n;i++){
            arr[i] = i;
        }
        return arr;
    }

    public static Integer[] generateRandomArry(int n,int bound){
        Integer[] arr = new Integer[n];
        Random rnd = new Random();
        for (int i= 0;i<n;i++){
            arr[i] = rnd.nextInt(bound);
        }
        return arr;
    }
}
